var t = require;
var e = module;
var o = exports;
var a,
    i =
        (this && this.__extends) ||
        ((a = function (t, e) {
            return (a =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                })(t, e);
        }),
        function (t, e) {
            a(t, e);
            function o() {
                this.constructor = t;
            }
            t.prototype = null === e ? Object.create(e) : ((o.prototype = e.prototype), new o());
        });
Object.defineProperty(o, "__esModule", {value: !0});
var n = t("BaseManager"),
    r = t("UIConfig"),
    s = t("UIManager"),
    c = {
        "1_1": {clickBtn: !0, call: [{index: "0", callKey: "1", checkId: "1", offDis: cc.v2(0, 0)}]},
        "1_2": {clickBtn: !0, call: [{index: "0", callKey: "1", checkId: "2", offDis: cc.v2(0, 0)}]},
        "1_3": {clickBtn: !0, call: [{index: "0", callKey: "1", checkId: "3", offDis: cc.v2(0, 0)}]},
        "1_0_1": {clickBtn: !0, call: [{index: "0", callKey: "1", checkId: "4", offDis: cc.v2(0, 0)}]},
        "1_0_2": {clickBtn: !0, call: [{index: "0", callKey: "1", checkId: "5", offDis: cc.v2(0, 0)}]},
        "2_0_1": {clickBtn: !0, call: [{index: "0", callKey: "1", checkId: "6", offDis: cc.v2(0, 0)}]},
        "2_0_2": {clickBtn: !1, call: [{index: "0", callKey: "1", checkId: "7", offDis: cc.v2(0, 0)}]},
        "3_0_1": {clickBtn: !0, call: [{index: "0", callKey: "1", checkId: "8", offDis: cc.v2(0, 0)}]},
        "3_0_2": {clickBtn: !0, call: [{index: "0", callKey: "1", checkId: "9", offDis: cc.v2(0, 0)}]},
        "3_0_3": {clickBtn: !0, call: [{index: "0", callKey: "1", checkId: "10", offDis: cc.v2(0, 0)}]},
        "3_0_4": {clickBtn: !0, call: [{index: "0", callKey: "1", checkId: "11", offDis: cc.v2(0, 0)}]},
        "3_0_5": {clickBtn: !0, call: [{index: "0", callKey: "1", checkId: "12", offDis: cc.v2(0, 0)}]},
        "3_0_6": {clickBtn: !0, call: [{index: "0", callKey: "1", checkId: "13", offDis: cc.v2(0, 0)}]},
        "3_0_7": {clickBtn: !0, call: [{index: "0", callKey: "1", checkId: "14", offDis: cc.v2(0, 0)}]},
        "3_0_8": {clickBtn: !0, call: [{index: "0", callKey: "1", checkId: "15", offDis: cc.v2(0, 0)}]},
        "3_0_9": {clickBtn: !0, call: [{index: "0", callKey: "1", checkId: "16", offDis: cc.v2(0, 0)}]},
        "4_0_1": {clickBtn: !0, call: [{index: "0", callKey: "1", checkId: "17", offDis: cc.v2(0, 0)}]},
        "4_0_2": {clickBtn: !0, call: [{index: "0", callKey: "1", checkId: "18", offDis: cc.v2(0, 0)}]},
        "5_0_1": {clickBtn: !0, call: [{index: "0", callKey: "1", checkId: "19", offDis: cc.v2(0, 0)}]},
        "5_0_2": {clickBtn: !0, call: [{index: "0", callKey: "1", checkId: "20", offDis: cc.v2(0, 0)}]}
    },
    p = (function (t) {
        i(e, t);
        function e(e, o) {
            void 0 === o && (o = !1);
            var a = t.call(this, e, o) || this;
            a.overIndex = {};
            a.overKey = {};
            a.onceIndex = {};
            a.map1 = !1;
            if (o) {
                a.loadData();
                a.init();
            }
            return a;
        }
        e.prototype.init = function () {};
        return e;
    })(n.ArchiveBase),
    l = new ((function () {
        function t() {
            this.checkId = {0: ["1_1", "1_2", "1_3"]};
            this.oncecheckId = {
                0: ["1_0_1", "1_0_2"],
                1: ["2_0_1", "2_0_2"],
                2: ["3_0_1", "3_0_2", "3_0_3", "3_0_4", "3_0_5", "3_0_6", "3_0_7", "3_0_8", "3_0_9"],
                3: ["4_0_1", "4_0_2"],
                4: ["5_0_1", "5_0_2"]
            };
            this.parseObj = {};
            this.psw = {aa: "overIndex", ab: "overKey", ac: "onceIndex"};
            this.saveKey = "GuildCacheSave";
            this.guidClickLimite = !1;
            this.checkKey = "";
            this.clickCardItemCardId = [];
            this.isCloseOver = !0;
            this.isViewGuild = !1;
        }
        t.prototype.parsePlayerData = function (t) {
            if ("" != t) {
                var e = this._archive,
                    o = JSON.parse(t);
                for (var a in o) {
                    var i = this.psw[a];
                    i && o[a] && (e[i] = o[a]);
                }
            }
        };
        t.prototype.getPlayerData = function () {
            var t = this._archive;
            for (var e in this.psw) {
                var o = this.psw[e];
                this.parseObj[e] = t[o];
            }
            return JSON.stringify(this.parseObj);
        };
        t.prototype.initAccount = function (t) {
            var e = this.saveKey,
                o = cc.sys.localStorage.getItem(e);
            this.saveKey = "GuildCacheSave_" + t;
            if (o) {
                cc.sys.localStorage.setItem(this.saveKey, o);
                cc.sys.localStorage.setItem(e, "");
            }
            this._archive = new p(this.saveKey, !0);
            this.checkLoadData();
        };
        t.prototype.checkLoadData = function () {
            var t = this;
            this._archive.map1 = !1;
            this._archive.map1 ||
                this.loadCallBack(function (e) {
                    t.parsePlayerData(e);
                    t._archive.saveData();
                });
        };
        t.prototype.loadCallBack = function (t) {
            var e = this;
            if (window.PlayerData && window.PlayerData.canLoadData) {
                window.PlayerData.checkOverCount++;
                t && t(PlayerData.getParseGuildString());
            } else
                setTimeout(function () {
                    e.loadCallBack(t);
                }, 100);
        };
        t.prototype.getCheckCof = function (t) {
            return c[t];
        };
        t.prototype.resetData = function () {
            this._archive = new p(this.saveKey, !1);
            this._archive.saveData();
        };
        t.prototype.isOverGuid = function (t) {
            return this._archive.overIndex[t] || !1;
        };
        t.prototype.overGuid = function (t) {
            this._archive.overIndex[t] = !0;
            CacheDataManager.updateDataSave();
            this._archive.saveData();
        };
        t.prototype.isOverOnceGuid = function (t) {
            return this._archive.onceIndex[t] || !1;
        };
        t.prototype.isOverKey = function (t) {
            return this._archive.overKey[t] || !1;
        };
        t.prototype.overKey = function (t) {
            this._archive.overKey[t] = !0;
            CacheDataManager.updateDataSave();
            this._archive.saveData();
        };
        t.prototype.overOnceGuid = function (t) {
            this._archive.onceIndex[t] = !0;
            CacheDataManager.updateDataSave();
            this._archive.saveData();
        };
        t.prototype.openGuildView = function (t) {
            void 0 === t && (t = null);
            if (!this.isViewGuild && this.isCloseOver) {
                this.isViewGuild = !0;
                this.isCloseOver = !0;
                s.default.open(r.UIID.UIGuild, t);
            }
        };
        t.prototype.isViewGuildDlg = function () {
            return this.isViewGuild;
        };
        t.prototype.closeGuildView = function () {
            if (this.isViewGuild) {
                s.default.closeUiByUIID(r.UIID.UIGuild);
                this.isViewGuild = !1;
                this.checkKey = "";
            }
        };
        return t;
    })())();
window.GuildCache = l;
o.default = l;
